package com.heima.search.controller;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.search.dto.UserSearchDto;
import com.heima.search.service.ApAssociateWordsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/api/v1/associate")
public class ApAssociateWordsController {

    @Resource
    private ApAssociateWordsService apAssociateWordsService;

    /**
     * 搜索联想词提示
     * @param dto
     * @return
     */
    @PostMapping("/search")
    public ResponseResult associateWords(@RequestBody UserSearchDto dto){
        return apAssociateWordsService.associateWords(dto.getSearchWords());
    }
}
